<div class="wrapper-md">
  <div class="row">

    
    <div class="panel panel-default">
      <tabset class="tab-container">
        <tab heading="接口列表" active="status.list" ng-click="cancel()">
          <!--  搜索框  -->
          <div class="col-sm-2" style="padding-left: 50px">
            <select ng-model="search.searchType" class="form-control" ng-init="search.searchType='0'">
              <option value="0">全部</option>
              <option value="1">新增</option>
              <option value="2">已有</option>
            </select>
          </div>
          <div class="col-sm-3">
            <div class="input-group" >
              <div class="input-group-btn" >
                <span class="btn btn-default">接口URL</span>
              </div>
              <input type="text" class="form-control" ng-model="search.url">
            </div>
          </div>
          <div class="col-sm-3">
            <div class="input-group" >
              <div class="input-group-btn" >
                <span class="btn btn-default">说明</span>
              </div>
              <input type="text" class="form-control" ng-model="search.msg">
            </div>
          </div>
          <div class="col-sm-2">
            <button class="btn m-b-xs w-xs btn-success" ng-click="search()">搜索</button>
          </div>

          <div class="panel-body">
            <!--  数据表格  -->
            <table class="table table-striped table-bordered ng-isolate-scope dataTable no-footer">
              <thead>
                <tr>
                  <!--<th style="width: 7%;text-align:center;">接口标识</th>-->
                  <th style="width: 7%;text-align:center;">接口地址</th>
                  <th style="width: 6%;text-align:center;">状态</th>
                  <th style="width: 7%;text-align:center;">登录类型</th>
                  <th style="width: 12%;text-align:center;">说明</th>
                  <th style="width: 11%;text-align:center;">更新时间</th>
                  <th style="width: 8%;text-align:center;">操作</th>
                </tr>
              </thead>
              <tbody>
                <tr ng-repeat="info in apiList">
                  <!--<td>{{info.id}}</td>-->
                  <td>{{info.id}}<br />{{info.url}}</td>
                  <td style="text-align:center;">{{info.state==0?'可用':'不可用'}}</td>
                  <td style="text-align:center;"><div ng-if="info.state==0">{{info.type=='1'?'需要登录':'无需登录'}}</div></td>
                  <td>
                    <div style="overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">
                      {{info.name}}
                    </div>
                  </td>
                  <td>{{info.update_date}}</td>
                  <td>
                    <button ng-if="info.type == '2'" type="button" class="btn btn-primary btn-xs" ng-click="open(info)">启用</button>
                    <div ng-if="info.type != '2'" >
                      <button type="button" class="btn btn-info btn-xs" ng-click="update(info)">修改</button>
                      <button type="button" class="btn btn-danger btn-xs" ng-click="delete($index)">删除</button>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
          <pagination 
              total-items="totalItems" 
              ng-model="currentPage" 
              ng-change="search(currentPage)"
              previous-text="上一页"
              next-text="下一页"
              first-text="首页"
              last-text="尾页"
              max-size="5"
              boundary-links="true"
              rotate="false"
              items-per-page="itemsPerPage"
              class="m-t-none m-b"></pagination>
        </tab>
         

        <tab heading="接口添加" ng-click="add()" ng-if="status.flag" active="status.add">
          <div class="panel-body">
            <form name="form" class="form-horizontal ng-pristine ng-valid-required">
              <div class="form-group">
                <label class="col-lg-2 control-label">接口地址:</label>
                <div class="col-lg-6">
                  <input type="text" class="form-control" ng-model="obj.url" placeholder='必填'>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">过滤类型:</label>
                <div class="col-lg-4">
                  <ui-select ng-model="obj.type" theme="bootstrap">
                    <ui-select-match placeholder="选择类型..">{{$select.selected.name}}</ui-select-match>
                    <ui-select-choices repeat="item.id as item in logintype | filter: $select.search">
                      <span ng-bind-html="item.name | highlight: $select.search"></span>
                    </ui-select-choices>
                  </ui-select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">状态:</label>
                <div class="col-lg-4">
                  <label class="i-switch m-t-xs m-r">
                    <input type="checkbox" ng-true-value="0" ng-false-value="1" ng-model="obj.state">
                    <i></i>
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">说明:</label>
                <div class="col-lg-4">
                  <input type="text" class="form-control" ng-model="obj.name">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">备注:</label>
                <div class="col-lg-4">
                  <textarea class="form-control" rows="3" ng-model="obj.description"></textarea>
                </div>
              </div>
            </form>
            <div class="col-lg-2"></div>
            <div class="col-lg-4">
              <button class="btn btn-primary btn-rounded" ng-click="save()">保存</button>
              <button class="btn btn-default btn-rounded" ng-click="cancel()">取消</button>
            </div>
          </div>
        </tab>

        <tab heading="修改接口" active="status.modify" ng-if="status.modify">
          <div class="panel-body">
            <form name="form" class="form-horizontal ng-pristine ng-valid-required">
              <div class="form-group">
                <label class="col-lg-2 control-label">接口地址:</label>
                <div class="col-lg-6">
                  <input type="text" class="form-control" ng-model="obj.url" placeholder='必填'>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">过滤类型:</label> 
                <div class="col-lg-4">
                  <ui-select ng-model="obj.type" theme="bootstrap">
                    <ui-select-match placeholder="选择类型..">{{$select.selected.name}}</ui-select-match>
                    <ui-select-choices repeat="item.id as item in logintype | filter: $select.search">
                      <span ng-bind-html="item.name | highlight: $select.search"></span>
                    </ui-select-choices>
                  </ui-select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">状态:</label>
                <div class="col-lg-4">
                  <label class="i-switch m-t-xs m-r">
                    <input type="checkbox" ng-true-value="0" ng-false-value="1" ng-model="obj.state">
                    <i></i>
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">说明:</label>
                <div class="col-lg-4">
                  <input type="text" class="form-control" ng-model="obj.name">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">备注:</label>
                <div class="col-lg-4">
                  <textarea class="form-control" rows="3" ng-model="obj.description"></textarea>
                </div>
              </div>
            </form>
            <div class="col-lg-2"></div>
            <div class="col-lg-4">
              <button class="btn btn-primary btn-rounded" ng-click="save()">保存</button>
              <button class="btn btn-default btn-rounded" ng-click="cancel()">取消</button>
            </div>
          </div>
        </tab>




      </tabset>
    </div>


    

 
  </div>
</div>
